<!--心理测评-->
<template>
  <div class="container">
    <div class="xd-LearningHome-NoticeCenter">
      <el-container class="xd-el-container">
        <el-main class="xd-el-main">
          <!-- <iframe :src="src" style="width: 100%; height: 600px" /> -->
          <el-card class="m_t_b_5px news_panel" shadow="hover">
            <div slot="header">
              <div class="title">小游戏</div>
            </div>
            <template v-if="!showGame">
            <ul class="news_list item_flex_ul">
              <li @click="doGame(1)">
                <!-- <span class="title">
            <span style="color:red;" v-if="p.i_is_top">【顶】</span>
            · {{ decodeURI(p.v_seach_v_notice_title)}}
          </span>
          <span class="time">{{p.dtm_publish_date}}</span> -->
                <el-row style="width: 100%">
                  <el-col :span="20" style="font-size: 12px">
                    <div>
                      <span
                        style="
                          font-weight: bold;
                          font-size: 18px;
                          margin-right: 12px;
                        "
                        >扫雷</span
                      >
                    </div>
                    <div>
                      <span style="font-size: 14px; color: #a5a0a0"
                        >扫雷小游戏</span
                      >
                    </div>
                    <!-- <div style="font-size:14px;">
                  <span><i class="el-icon-edit"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-chat-dot-square"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-star-on"></i> 4349</span>
                </div> -->
                  </el-col>
                  <el-col :span="4">
                    <div class="block">
                      <img src="@/assets/imgs/xzq-test-item.png" />
                    </div>
                  </el-col>
                </el-row>
              </li>

               <li  @click="doGame(4)">
                              <!-- <span class="title">
                          <span style="color:red;" v-if="p.i_is_top">【顶】</span>
                          · {{ decodeURI(p.v_seach_v_notice_title)}}
                        </span>
                        <span class="time">{{p.dtm_publish_date}}</span> -->
                              <el-row style="width: 100%">
                                <el-col :span="20" style="font-size: 12px">
                                  <div>
                                    <span
                                      style="
                                        font-weight: bold;
                                        font-size: 18px;
                                        margin-right: 12px;
                                      "
                                      >魔方</span
                                    >
                                  </div>
                                  <div>
                                    <span style="font-size: 14px; color: #a5a0a0"
                                      >变幻魔方</span
                                    >
                                  </div>
                                  <!-- <div style="font-size:14px;">
                                <span><i class="el-icon-edit"></i> 4349 </span>
                               <span style="margin-left:10px;"><i class="el-icon-chat-dot-square"></i> 4349 </span>
                               <span style="margin-left:10px;"><i class="el-icon-star-on"></i> 4349</span>
                              </div> -->
                                </el-col>
                                <el-col :span="4">
                                  <div class="block">
                                    <img src="@/assets/imgs/xzq-test-item.png" />
                                  </div>
                                </el-col>
                              </el-row>
                            </li>


                   <li  @click="doGame(2)">
                <!-- <span class="title">
            <span style="color:red;" v-if="p.i_is_top">【顶】</span>
            · {{ decodeURI(p.v_seach_v_notice_title)}}
          </span>
          <span class="time">{{p.dtm_publish_date}}</span> -->
                <el-row style="width: 100%">
                  <el-col :span="20" style="font-size: 12px">
                    <div>
                      <span
                        style="
                          font-weight: bold;
                          font-size: 18px;
                          margin-right: 12px;
                        "
                        >俄罗斯方块</span
                      >
                    </div>
                    <div>
                      <span style="font-size: 14px; color: #a5a0a0"
                        >俄罗斯方块小游戏</span
                      >
                    </div>
                    <!-- <div style="font-size:14px;">
                  <span><i class="el-icon-edit"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-chat-dot-square"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-star-on"></i> 4349</span>
                </div> -->
                  </el-col>
                  <el-col :span="4">
                    <div class="block">
                      <img src="@/assets/imgs/xzq-test-item.png" />
                    </div>
                  </el-col>
                </el-row>
              </li>



                   <li  @click="doGame(3)">
                <!-- <span class="title">
            <span style="color:red;" v-if="p.i_is_top">【顶】</span>
            · {{ decodeURI(p.v_seach_v_notice_title)}}
          </span>
          <span class="time">{{p.dtm_publish_date}}</span> -->
                <el-row style="width: 100%">
                  <el-col :span="20" style="font-size: 12px">
                    <div>
                      <span
                        style="
                          font-weight: bold;
                          font-size: 18px;
                          margin-right: 12px;
                        "
                        >贪吃蛇</span
                      >
                    </div>
                    <div>
                      <span style="font-size: 14px; color: #a5a0a0"
                        >贪吃蛇小游戏</span
                      >
                    </div>
                    <!-- <div style="font-size:14px;">
                  <span><i class="el-icon-edit"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-chat-dot-square"></i> 4349 </span>
                 <span style="margin-left:10px;"><i class="el-icon-star-on"></i> 4349</span>
                </div> -->
                  </el-col>
                  <el-col :span="4">
                    <div class="block">
                      <img src="@/assets/imgs/xzq-test-item.png" />
                    </div>
                  </el-col>
                </el-row>
              </li>
            </ul>
</template>
<template v-else>
<a @click="doBlack" style="line-height: 30px;cursor: pointer;font-weight: bold;"> 返回</a>
             <iframe :src="gameSrc" frameborder="no" style="width:100%;height:900px;boder:1px solid #EBEEF5"/>
             </template>
          </el-card>
        </el-main>
        <el-aside class="xd-el-aside" width="16vw">
          <el-card class="box-card m_t_b_1vw" shadow="hover">
            <div slot="header">
              <div class="tag">新品首发</div>
            </div>
            <div
              v-for="(item, index) in topNoticeList"
              :key="'top' + index"
              class="aside-list-item"
               @click="doGame(item.id)"
            >
              {{ "· " + item.v_seach_v_notice_title }}
            </div>
          </el-card>
        </el-aside>
      </el-container>
    </div>
  </div>
</template>
<script>
export default {
  name: "CinziqaoTest",
  data() {
    return {
      showGame:false,
      gameSrc: "/game/saolei/demo.html",
      topNoticeList: [
        { v_seach_v_notice_title: "扫雷" ,id:1 },
        { v_seach_v_notice_title: "魔方" ,id:2},
        { v_seach_v_notice_title: "俄罗斯方块" ,id:3},
        { v_seach_v_notice_title: "贪吃蛇",id:4 }, 
      ],
      newsList: [],
    };
  },
  methods: {
    fetchNoticeList() {
      utils.post("/notice/importantNotice", {}, (res) => {
        if (res.success) {
          this.topNoticeList = res.data.rows;
        }
      });
    },
    goNewsDetail(id) {
      //this.$router.push({ path: '/LearningHome/NoticeCenter/Detail', query: { id: id, activeMenu: '/LearningHome/NoticeCenter' } })
    },
    doGame(type){
      this.showGame =true;
      switch (type) {
        case 1:
          this.gameSrc = "game/saolei/demo.html";
          break;
          case 2:
            this.gameSrc = "game/eluosifangkuai/index.html";
            break;
          case 3:
            this.gameSrc = "game/tcs/index.html";
            break;
          case 4:
            this.gameSrc = "game/mf/index.html";
            break;
        default:
          break;
      }
    },
    doBlack(){
      this.showGame =false;
    }
  },
  created() {
    this.$store.commit("updateActiveMenu", "/Cinziqao/Train");
    //this.fetchNoticeList()
  },
};
</script>
<style lang="less">
.aside-list-item {
  cursor: pointer;
  padding: 5px 0;
}
.xd-LearningHome-NoticeCenter {
  .news_panel {
    ul.news_list li {
      border-bottom: solid 1px #dcdfe6;
      padding-bottom: 5px;
    }
  }
}
</style>
